package com.wu.shop.module.classify.ui.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import com.wkq.lib_base.adapter.KtAdapter
import com.wu.common.base.adapter.DataBindingViewHolder
import com.wu.shop.R
import com.wu.shop.databinding.ItemClassifyTagBinding
import com.wu.shop.module.classify.frame.model.ClassifyTagInfo


/**
 * @author wkq
 *
 * @date 2021年07月06日 16:27
 *
 *@des
 *
 */

class ClassifyTagAdapter(mContext: Context) : KtAdapter<ClassifyTagInfo>(mContext) {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        var viewDataBinding = DataBindingUtil.inflate<ItemClassifyTagBinding>(
            LayoutInflater.from(mContext),
            R.layout.item_classify_tag,
            parent,
            false
        );
        var viewHolder = DataBindingViewHolder(viewDataBinding.root)
        viewHolder.binding = viewDataBinding
        return viewHolder
    }


    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        var bindingViewHolder = holder as DataBindingViewHolder
        var binding = bindingViewHolder.binding as ItemClassifyTagBinding;
        binding.tvTagName.text = getItem(position)!!.tagName
    }


}